package com.relife.core.entity;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * 用户角色部门
 * 
 * @author WU
 * @date 2017年3月23日 上午11:27:00
 */
@Entity
@Table(name = "sys_user_role")
public class UserRoleEntity extends BaseEntity {

	private static final long serialVersionUID = 1L;

	private UserEntity user;
	private DepartmentEntity depart;
	private RoleEntity role;

	public UserRoleEntity() {
	}

	public UserRoleEntity(String id) {
		super.setId(id);
	}

	public UserRoleEntity(UserEntity user, RoleEntity role) {
		this.user = user;
		this.role = role;
	}

	public UserRoleEntity(UserEntity user, DepartmentEntity depart, RoleEntity role) {
		this.user = user;
		this.depart = depart;
		this.role = role;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "USER_ID")
	public UserEntity getUser() {
		return user;
	}

	public void setUser(UserEntity user) {
		this.user = user;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "DEPART_ID")
	public DepartmentEntity getDepart() {
		return depart;
	}

	public void setDepart(DepartmentEntity depart) {
		this.depart = depart;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "ROLE_ID")
	public RoleEntity getRole() {
		return role;
	}

	public void setRole(RoleEntity role) {
		this.role = role;
	}
}
